﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
using DQYT.HTDZ.BLL;
using DQYT.HTDZ.Model;

namespace DQYT.HTDZ.Web.BDJTWELL
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtGQID.Text.Trim().Length==0)
			{
				strErr+="GQID不能为空！\\n";	
			}
			if(this.txtWELLID.Text.Trim().Length==0)
			{
				strErr+="WELLID不能为空！\\n";	
			}
			if(this.txtTYJM.Text.Trim().Length==0)
			{
				strErr+="TYJM不能为空！\\n";	
			}
			if(this.txtBZJM.Text.Trim().Length==0)
			{
				strErr+="BZJM不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtKZRQ.Text))
			{
				strErr+="KZRQ格式错误！\\n";	
			}
			if(this.txtDLWZ.Text.Trim().Length==0)
			{
				strErr+="DLWZ不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtWD.Text))
			{
				strErr+="WD格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtJD.Text))
			{
				strErr+="JD格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtSFPTJ.Text))
			{
				strErr+="SFPTJ格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtSFHSJ.Text))
			{
				strErr+="SFHSJ格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtSFHDJ.Text))
			{
				strErr+="SFHDJ格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtSS.Text))
			{
				strErr+="SS格式错误！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			string GQID=this.txtGQID.Text;
			string WELLID=this.txtWELLID.Text;
			string TYJM=this.txtTYJM.Text;
			string BZJM=this.txtBZJM.Text;
			DateTime KZRQ=DateTime.Parse(this.txtKZRQ.Text);
			string DLWZ=this.txtDLWZ.Text;
			decimal WD=decimal.Parse(this.txtWD.Text);
			decimal JD=decimal.Parse(this.txtJD.Text);
			decimal SFPTJ=decimal.Parse(this.txtSFPTJ.Text);
			decimal SFHSJ=decimal.Parse(this.txtSFHSJ.Text);
			decimal SFHDJ=decimal.Parse(this.txtSFHDJ.Text);
			decimal SS=decimal.Parse(this.txtSS.Text);

			BDJTWELLModel model=new BDJTWELLModel();
			model.GQID=GQID;
			model.WELLID=WELLID;
			model.TYJM=TYJM;
			model.BZJM=BZJM;
			model.KZRQ=KZRQ;
			model.DLWZ=DLWZ;
			model.WD=WD;
			model.JD=JD;
			model.SFPTJ=SFPTJ;
			model.SFHSJ=SFHSJ;
			model.SFHDJ=SFHDJ;
			model.SS=SS;

			BDJTWELLBLL bll=new BDJTWELLBLL();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
